
package sifApp.sifAppStatic;

import android.content.Context;
import android.content.SharedPreferences;

public class SaveData {

    private static SaveData saveData = null;
    private SharedPreferences sharePreference;

    public SaveData(Context context)
    {
        sharePreference = context.getSharedPreferences("SIF", Context.MODE_PRIVATE);
    }

    public static SaveData getInstance(Context context)
    {
        if (saveData == null)
        {
            saveData = new SaveData(context);
        }
        return saveData;
    }

    public void setMyAccountId(String myAccountId)
    {
        sharePreference.edit().putString("my_account_id", myAccountId).commit();
    }

    public String getMyAccountId()
    {
        return sharePreference.getString("my_account_id", null);
    }
    
    public void setAccessToken(String accessToken)
    {
        sharePreference.edit().putString("access_token", accessToken).commit();
    }

    public String getAccessToken()
    {
        return sharePreference.getString("access_token", null);
    }
    
    public void setAccessExpire(long accessExpires)
    {
        sharePreference.edit().putLong("access_expires", accessExpires).commit();
    }

    public long getAccessExpire()
    {
        return sharePreference.getLong("access_expires", 0);
    }
}
